package www.nupter.org.njuptask.application;

import android.app.Application;
import android.widget.ImageView;


import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;

import org.xutils.x;

import java.io.File;
import java.util.HashSet;
import java.util.Set;

import cn.jpush.android.api.JPushInterface;


/**
 * Created by fangzhenyi on 15/11/9.
 */
public class MyApplication extends Application {
    private String TAG="APPLICATION";
    private static MyApplication mInstance;
    private Set<String>tag=new HashSet<>();
    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
        x.Ext.init(this);
        x.Ext.setDebug(true);
        JPushInterface.setDebugMode(true); 	// 设置开启日志,发布时请关闭日志
        JPushInterface.init(this);
        tag.add("pushScreen");
        }

    public static  void initImage(ImageView imageView, String imageUrl) {
         x.image().bind(imageView,imageUrl);
        //Picasso.with(getContext()).load(imageUrl).into(imageView);
    }

    public static void initLocalImage(ImageView imageView,String path){
        Picasso.with(getContext()).load(new File(path)).resize(200, 200).centerCrop().into(imageView);
    }

    public static void initImage(ImageView imageView, String imageUrl, Callback callback){
        Picasso.with(getContext()).load(imageUrl).into(imageView,callback);
    }

    public static MyApplication getContext() {
        return mInstance;
    }
}
